﻿using Fungus;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Sword : MonoBehaviour
{
    GameObject skill;
    Flowchart fungus;
    GameObject data;
    int dialogueValue;
    // Start is called before the first frame update
    void Start()
    {
        data = GameObject.FindGameObjectWithTag("Data");
        skill = GameObject.FindGameObjectWithTag("Skill");
        fungus = skill.GetComponent<Flowchart>();
        
    }

    //剑豪龙驹
    private void OnMouseDown()
    {
        dialogueValue = data.GetComponent<GameData>().dialogueValue;
        print(dialogueValue);
        switch (dialogueValue)
        {
            case 2:
                fungus.ExecuteBlock("SummaryEvent2");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 5:
                fungus.ExecuteBlock("SummaryEvent5");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 6:
                fungus.ExecuteBlock("Linear6");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 9:
                fungus.ExecuteBlock("Linear9");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 10:
                fungus.ExecuteBlock("Queue10"); 
                data.GetComponent<GameData>().dialogueValue++; break;
            case 15:
                fungus.ExecuteBlock("Queue15");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 16:
                fungus.ExecuteBlock("Strand16"); 
                data.GetComponent<GameData>().dialogueValue++; break;
            case 21:
                fungus.ExecuteBlock("Strand21");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 22:
                fungus.ExecuteBlock("Array22");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 26:
                fungus.ExecuteBlock("Array26");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 27:
                fungus.ExecuteBlock("Tree27"); 
                data.GetComponent<GameData>().dialogueValue++; break;
            case 30:
                fungus.ExecuteBlock("Tree30");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 31:
                fungus.ExecuteBlock("Chart31");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 34:
                fungus.ExecuteBlock("Chart34");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 35:
                fungus.ExecuteBlock("Chart35");
                data.GetComponent<GameData>().dialogueValue++; break;
            case 37:
                fungus.ExecuteBlock("Forest"); break;
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
